<?php
	include('../init.php');
	
	$subject = ($_POST['subject']); 
	$name = ($_POST['name']); 
	$email = $_POST['email']; 
	$tel = $_POST['phone'];
	$msg = nl2br($_POST['desc']); 
	
	$to      = $_POST['contact_mail'];
	//$to      = 'admin@localhost.com';
	
	$subject = SITENAME.' : Message from contact.';
	$message = '<strong>Subject : </strong>'.$subject;
	$message .= '<br /><strong>Name : </strong>'.$name;
	$message .= '<br /><strong>Phone : </strong>'.$tel;
	$message .= '<br /><strong>E-Mail. : </strong>'.$email;
	$message .= '<br /><strong>Description : </strong>'.$msg;
	
	$headers  = 'MIME-Version: 1.0' . "\r\n";
	$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
	$headers .= "From: $email" . "\r\n" .
		"Reply-To: $email" . "\r\n" .
		'X-Mailer: PHP/' . phpversion();
	
	if(@mail($to, $subject, $message, $headers))
	{
		echo 'success';
	}
	else
	{
		echo 'Can\'t sent message, please try again later.';
	}
?>